export function objToStyle(style: { [key: string]: (string | number) }) {
    try {
        let styleStr = '';
        for (let key in style) {
            styleStr += `${key}:${style[key]};`;
        }
        return styleStr;
    } catch (error) {
        return '';
    }
}
export function createDom(tag: string, style: { [key: string]: (string | number) }, attr: { [key: string]: any } = {}) {
    let ele = document.createElement(tag);
    ele.setAttribute('style', objToStyle(style));
    try {
        for (let key in attr) {
            ele.setAttribute(key, attr[key]);
        }
    } catch (error) {

    }
    return ele;
}